package util;

/**
 *
 * @author Dragan Sahpaski
 */
public class QueryConfiguration {

    private double percentageGroupBy;
    private double percentageWhere;
    private double percentageEquals;

    enum Conf {

        Random, Fixed
    }
    private Conf conf;

    public QueryConfiguration() {
        percentageGroupBy = Double.NaN;
        percentageWhere = Double.NaN;
        conf = Conf.Random;
    }

    public QueryConfiguration(double percentageGroupBy, double percentageWhere, double percentageEquals) {
        if (percentageGroupBy > 100 || percentageGroupBy < 0) {
            throw new IllegalArgumentException("The percentage of group by atributes in a query cannot be less than zero or grater than onehundered.");
        }
        if (percentageWhere > 100 || percentageWhere < 0) {
            throw new IllegalArgumentException("The percentage of where atributes in a query cannot be less than zero or grater than onehundered.");
        }
        if (percentageEquals > 100 || percentageEquals < 0) {
            throw new IllegalArgumentException("The percentage of equal conditions in a where clause cannot be less than zero or grater than onehundered.");
        }
        this.percentageGroupBy = percentageGroupBy;
        this.percentageWhere = percentageWhere;
        this.percentageEquals = percentageEquals;
        conf = Conf.Fixed;
    }

    public boolean isConfigRandom() {
        return conf == Conf.Random;
    }

    public boolean isConfigFixed() {
        return conf == Conf.Fixed;
    }

    public double getPercentageGroupBy() {
        return percentageGroupBy;
    }

    public double getPercentageWhere() {
        return percentageWhere;
    }

    public double getPercentageEquals() {
        return percentageEquals;
    }
}
